#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int maxConsecutiveAnswers(string answerKey, int k)
    {
        int n = answerKey.size(), ans = 0, left = 0, cntt = 0, cntf = 0;
        for (int right = 0; right < n; ++right)
        {
            answerKey[right] == 'T' ? cntt++ : cntf++;
            while (cntf > k && cntt > k)
            {
                answerKey[left++] == 'T' ? cntt-- : cntf--;
            }
            ans = max(ans, right - left + 1);
        }
        return ans;
    }
};

int main()
{

    // system("pause");
    return 0;
}
